package com.shao.array;

public class array03 {
    public static void main(String[] args) {
        int[] num={1,23,3,4,5};
//        打印所有元素
        for (int i = 0; i < num.length; i++) {
            System.out.println(num[i]);
        }
    System.out.println("========================");
//        计算所有元素和
        int sum=0;
        for (int i = 0; i < num.length; i++) {
            sum+=num[i];

        }
        System.out.println("sum="+sum);
    System.out.println("========================");
//查找最大元素
        int max=num[0];
        for (int i = 1; i <num.length ; i++) {
            if (num[i]>max){
                max=num[i];
            }

        }
        System.out.println("max="+max);
    }

}
